package com.lagou.edu.Spring;

import com.lagou.edu.zdy.rpc.ServiceBootstrap;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 进行启动扫描：根据启动类的位置，扫描包
 */
public class SpringApplication {

    public static void run(Class<ServiceBootstrap> serviceBootstrap, String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        //创建ApplicationContext
        ApplicationContext.createContext();

        //反射启动项目
        Method main = serviceBootstrap.getMethod("main", String[].class);
        main.invoke(null,(Object) args);
    }
}
